import React, {Component, PureComponent} from 'react';

//优化页面渲染
class PureComponentLol extends PureComponent {
    state = {
        time: 1,
    }
    edit = () => {
        this.setState({
            time: new Date().getTime()
        })
    }

    edit2 = () => {
        this.setState({})
    }

    render() {
        console.log('PureComponentLol渲染我了')
        return (
            <div>
                我的集成Component {this.state.time}
                <button onClick={this.edit}>修改数据</button>
                &nbsp;
                <button onClick={this.edit2}>假修改数据</button>
                <A></A>
            </div>
        );
    }
}

class A extends Component {

    state = {
        time: 1,
    }
    edit = () => {
        this.setState({
            time: new Date().getTime()
        })
    }

    edit2 = () => {
        this.setState({})
    }

    render() {
        console.log('A渲染我了')
        return (
            <div>
                我的集成1{this.state.time}
                <button onClick={this.edit}>修改数据</button>
                &nbsp;
                <button onClick={this.edit2}>假修改数据</button>
            </div>
        );
    }
}


export default PureComponentLol;